package org.dey.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.dey.pojo.Order;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author hg
 * @date 2022/3/15
 * @classname
 */
@Repository
public interface OrderMapper extends BaseMapper<Order> {

    @Select(" SELECT t.id           ,\n" +
            "        t.orderDate    ,\n" +
            "        tm.file_number  ,\n" +
            "        tm.name         ,\n" +
            "        tm.phone_number ,\n" +
            "        t.orderType     ,\n" +
            "        t.orderStatus    FROM t_member tm " +
            "         INNER JOIN t_order t ON tm.id = t.member_id" )
    @Results(
            id = "OrderMapper", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "orderDate", property = "orderDate"),
            @Result(column = "orderType", property = "orderType"),
            @Result(column = "orderStatus", property = "orderStatus"),
            @Result(column = "file_number", property = "fileNumber"),
            @Result(column = "name", property = "name"),
            @Result(column = "phone_number", property = "phoneNumber"),
    })
    List<Order> queryorder(@Param("str") String str);
}
